<?php
/* 
 * @fileName       : cropImg.php
 * @Copyright      : (c) 2012 Chienlv.
 * @software       : is developed by the technical team of Hung Viet .
 * @Blog           : levanchien.info.
 * @Yahoo          : levanchien_info.
 * @Email          : admin@levanchien.info.
 * @Mobile         : 0989092938.
 * @Description of : - kích thước ảnh đã cấu hình sẵn trong hệ thông theo mỗi type được truyền từ site/actionCropt
 */
list($width, $height) = getimagesize($image['src']);
$this->widget('application.widgets.admin.cropzoom.JCropZoom', array(
			'width' => 777,
			'height' => 400,
            'id' => 'cropZoom1',
			'options'=>array(
				'selector' => array(
					'centered' => true,
					'borderColor' => 'red',
					'borderColorHover' => 'black',
					'aspectRatio' => true,
					'w'=> $image['sizeW'],// config width default is 96
					'h'=> $image['sizeH'], // config height default is 96
					'maxWidth'=>$image['sizeW'],
					'maxHeight'=>$image['sizeH'],
				),
			),
			'containerId'=>'crop_container',
			'callbackUrl'=>$this->createUrl(
                    'site/handleCropZoom',
                    array(
                        'modelId'=>$image['modelId'],
                        'modelName'=>$image['modelName'],
                        'imageType'=>$image['type'],
                        'imageFormat'=>$image['format'],
                        'imageId'=>$image['id'],
                        )
            ),
            'onServerHandled' => 'js:function(result){
				$.afterCroped(result);
             }',
            'image'=>array(
				'source'=>$image['src'],
				'width' =>$width,
				'height' => $height,
                'minZoom' =>10,
                'maxZoom' =>350,
			   )
		  ));
$backUrl = (Yii::app()->user->hasState('backUrl'))? Yii::app()->user->getState('backUrl') : '/';
?>
<a id="restore-image" href="javascript:void(0);" onclick="cropZoom1.restore();"><?php echo Yii::t('BackEnd','Restore');?></a>
<a id="btn-cancle" href="javascript:void(0);" onclick="$.goBack(this);" rel="<?php echo $backUrl;?>"><?php echo Yii::t('Global','Cancle');?></a>
<div id="examples" style="width: 777px !important;">
	<div id="crop_container"></div>
</div>